package com.study.thread.demo.threadpool;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 社保线程工厂
 *
 * @author wuxj
 */
public class TreadFactoryDemo implements ThreadFactory {

    private final AtomicInteger atomicInteger = new AtomicInteger(1);

    @Override
    public Thread newThread(Runnable r) {
        Thread t = new Thread(r, "test-thread-" + atomicInteger.getAndIncrement());
        System.out.println(t.getName() + " has been created");
        return t;
    }
}
